//
//  SKBtn_btnEncapsulation.m
//  SKaURobot
//
//  Created by cdong on 16/2/20.
//  Copyright © 2016年 cdong. All rights reserved.
//

#import "SKBtn_btnEncapsulation.h"

@implementation SKBtn_btnEncapsulation

- (instancetype)initWithFrame:(CGRect)frame imageName:(NSString *)imageName title:(NSString *)title
{
    self = [super initWithFrame:frame];
    if (self) {
        self.imageBtn = [UIButton buttonWithType:UIButtonTypeSystem];
        self.imageBtn.frame = CGRectMake((frame.size.width - 30*matchW)/2, 0 ,30*matchW , 30*matchW);
        [self.imageBtn setBackgroundImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
        [self addSubview:self.imageBtn];
        
        self.titleBtn = [UIButton buttonWithType:UIButtonTypeSystem];
        self.titleBtn.frame = CGRectMake(0, 38*matchH,CGRectGetWidth(frame) , frame.size.height - 30*matchH);
        [self.titleBtn setTitle:title forState:UIControlStateNormal];
        self.titleBtn.tintAdjustmentMode = NSTextAlignmentCenter;
        [self.titleBtn setTitleColor:[RGBColorEncapsulation colorWithRGB:0x908f8f alpha:1] forState:UIControlStateNormal];
        self.titleBtn.titleLabel.font = [UIFont systemFontOfSize:12*matchW];
        [self addSubview:self.titleBtn];
    }
    return self;
}

@end
